home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-20 / rs0422.zip / ROSEZSW / INIT.C < prev    next >
C/C++ Source or Header  |  1990-11-13  |  6KB  |  189 lines

  1. /*
  2.  * Copyright 1988 by the Radio Amateur Telecommunications Society
  3.  * and Thomas A. Moulton, W2VY
  4.  *
  5.  * This software may only be modified, copied, distributed or
  6.  * executed for non-profit purposes by individuals operating
  7.  * systems in the Amateur Radio Service.  Credit to the
  8.  * author(s) and to the Radio Amateur Telecommunications Society
  9.  * must be made in modules where RATS provided software is used,
  10.  * and in any announcements and documentation.  
  11.  *
  12.  * As a non-profit, research and development organization,  the
  13.  * Radio Amateur Telecommunications Society distributes software
  14.  * in both executable and source forms.  This policy is in place
  15.  * to encourage the development and distribution of OSI-based,
  16.  * networking tools.  In order to protect the interests of the
  17.  * Society and the authors, we have placed some conditions
  18.  * of use on the software.  Other groups are encouraged
  19.  * to place the same or similar guidelines on
  20.  * software they produce.
  21.  *
  22.  * The Radio Amateur Telecommunications Society reserves the right
  23.  * to specify and alter the terms under which software provided by
  24.  * the Society may be used.  This policy is consistent with the 
  25.  * objective of uniform and consistent "Open Systems Interconnections."
  26.  * 
  27.  * All acceptable Amateur Radio related uses of this software
  28.  * will be outlined in the "ROSE Implementer's Guide".  Individuals
  29.  * or organizations wishing to add to, or modify the provisions of
  30.  * the guide to accommodate local or evolutionary requirements
  31.  * should document the proposed change(s) and forward them to the
  32.  * Society.  If accepted, written notification will be provided by
  33.  * the Society to the submitting organization or individual(s).
  34.  * The Society will then issue a "ROSE Implementer's Guide Change
  35.  * Notice".  Periodically, the Society will re-issue the "ROSE 
  36.  * Implementer's Guide" and incorporate the text of the change 
  37.  * notices.  This procedure has been put in to place to ensure
  38.  * compatibility between systems and to ensure their "Openness"
  39.  * and interoperability.
  40.  *
  41.  * No part of this software may be used in other packages 
  42.  * without prior authorization from the author or the Society.  
  43.  * Software incorporating this module, all or in part, must be 
  44.  * provided to the Society prior to distribution or use by
  45.  * anyone not directly involved in testing of the revised  
  46.  * environment.  Current releases of the combined software must
  47.  * be provided to the Society in both source and executable
  48.  * forms.  Adequate documention to produce an executable module 
  49.  * from the provided source must also be included.
  50.  *
  51.  * Non-Amateur Radio non-profit uses may be authorized on a case
  52.  * by case basis.  Inquiries for such use may be made in writing
  53.  * to the Society. Non-commercial uses consistent with the
  54.  * general principles of Open Systems Interconnection Reference
  55.  * Model will be generally considered with favor.
  56.  *
  57.  * Commercial licensing of the software is also available based
  58.  * on normal commercial terms.  Licensing inquiries should be
  59.  * directed to the Society.  Commercial licensing of the standard
  60.  * software will be done in situations which materially benefit
  61.  * the Amateur Radio Packet Network.  Additional licensing is
  62.  * reserved by the individual authors.
  63.  * 
  64.  * The Radio Amateur Telecommunications Society provides this software
  65.  * on an "as is" basis.  The Society assumes no liability for
  66.  * loss incurred through the use of this software.  Amateur Radio
  67.  * use of this software implies non-commercial and voluntary 
  68.  * development, deployment and use of this software in a "Amateur",
  69.  * non-commercial service.  Commercial users are encouraged to
  70.  * inspect their copies of the source code.  Source code modification
  71.  * licenses are available if a combined Object and Source Code
  72.  * license was not originally established.
  73.  * 
  74.  * The Society may be contacted by writing or calling at:
  75.  * 
  76.  * The Radio Amateur Telecommunications Society 
  77.  * 206 North Vivyen Street.
  78.  * Bergenfield, New Jersey 07621
  79.  *
  80.  * Telephone: 201-387-8896
  81.  *
  82.  */
  83. /* This file will init the structs needed for L2 and L3 */
  84.  
  85. #include "data.h"
  86. #include "buffer.h"
  87. #include "iface.h"
  88. #include "timer.h"
  89. #include "ax25.h"
  90. #include "ax25l2.h"
  91.  
  92. extern struct ax25_addr L3CALL[];
  93. void level3();
  94. int l3_st_up();
  95. extern struct ax25_parms *l3parms;
  96.  
  97. void siosnd();
  98. struct datastr *ax25l2();
  99. int NULLFCN();
  100. struct datastr *NULLPKT();
  101. extern struct interface *ifaces[4];
  102.  
  103. struct interface port_null = {255, "None", NULLFCN, NULLPKT, NULLPKT, NULLFCN, NULLFCN };
  104.  
  105. struct interface port0 = {0, "P0", siosnd, ax25l2, NULLPKT, NULLFCN, NULLFCN };
  106. struct interface port1 = {1, "P1", siosnd, ax25l2, NULLPKT, NULLFCN, NULLFCN };
  107. #if 0
  108. struct interface port2 = {2, "P2", siosnd, ax25l2, NULLPKT, NULLFCN, NULLFCN };
  109. struct interface port3 = {3, "P3", siosnd, ax25l2, NULLPKT, NULLFCN, NULLFCN };
  110.  
  111. struct interface *difaces[4]= { &port0, &port1, &port2, &port3 };
  112. #else
  113.  
  114. struct interface *difaces[4]= { &port0, &port1, &port_null, &port_null };
  115. #endif
  116.  
  117. int l2_reset(), l2_clear(), l2_send(), l2_recv(), l2_con();
  118. int (*dL2PARS[5])() = { l2_reset, l2_clear, l2_send, l2_recv, l2_con};
  119.  
  120. int l3_reset(), l3_clear(), l3_send(), l3_recv(), l3_connected();
  121. int (*dL3PARS[5])() = { l3_reset, l3_clear, l3_send, l3_recv, l3_connected};
  122.  
  123. struct datastr *
  124. NULLPKT()
  125. {
  126.     return NULL;
  127. }
  128.  
  129. void
  130. siosnd(ifx, pkt)
  131. struct interface *ifx;
  132. struct datastr *pkt;
  133. {
  134.     void SIO_SND();
  135.  
  136.     SIO_SND(ifx->dev, pkt);
  137. }
  138.  
  139. void
  140. L1_RECV(pktx,chan)
  141. struct datastr *pktx;
  142. int chan;
  143. {
  144.     static struct datastr *pkt;
  145.     static struct interface *ifx;
  146.  
  147.     pkt=pktx;
  148.     ifx = ifaces[chan];
  149.     if (pkt) {
  150.         pkt=(struct datastr *)(*ifx->recv)(ifx, pkt);
  151.         free_pkt(pkt);
  152.     }
  153. }
  154.  
  155. void
  156. ASYBRK(chan)
  157. int chan;
  158. {}
  159.  
  160. void
  161. restart()
  162. {}
  163.  
  164. /* The above is used by the memory allocation routines when we run
  165.    out of memory, should have a reset function to call to attempt
  166.    to free up some memory, and a counter (error-level) and if it gets
  167.    called "too much" have it call restart... a few times then call boot() */
  168.  
  169. init()
  170. {
  171.     void link_count();
  172.  
  173.     queue(NULL,link_count,1,0);    /* Dec link counters every second */
  174. }
  175.  
  176. #if 0
  177. void
  178. restart()
  179. {
  180.     static struct axcb *lnk;
  181.  
  182.     lnk=links;
  183.     while (lnk) /* For all active links */ {
  184.         close_ax25(lnk);
  185.     }
  186. }
  187. #endif
  188.  
  189.